package com.shijie.beauty.controller;

import com.shijie.beauty.model.User;
import com.shijie.beauty.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/6/9 0009.
 */
@RestController
@Api(value = "用户管理", description = "用户管理")
@RequestMapping("/user")
public class UserController {

    @Resource
    private IUserService userService;
    @ResponseBody
    @ApiOperation(value = "查询用户")
    @RequestMapping("/showUser")
    public String toIndex(HttpServletRequest request, Model model) {
        int userId = Integer.parseInt(request.getParameter("id"));
        User user = this.userService.getUserById(userId);
        model.addAttribute("user", user);
        return "showUser";
    }

}
